package org.jeecg.modules.ncmeapis.network.service;

import org.jeecg.modules.ncmeapis.network.entities.entity.NetworkPath;
import org.jeecg.modules.ncmeapis.network.entities.entity.vo.PathWithPerm;

import java.util.List;

public interface INetworkPermissionService {

    NetworkPath checkPathExist(String pathId, String msg);

    NetworkPath checkPathExist(String pathId);

    void checkPathType(NetworkPath networkPath, String pathType, String msg);

    void checkPathType(NetworkPath networkPath, String pathType);

    /**
     * 获取用户目录权限
     *
     * @param paths  要查询的目录 List
     * @param userId 用户 id
     * @return 仅筛选出配置了权限的目录(包括从父级继承的权限), 针对不同场景,还需根据权限内容手动进行过滤
     */
    List<PathWithPerm> getPathsWithPermsByUserId(List<NetworkPath> paths, String userId);

    /**
     * 检查用户是否有指定目录的指定权限
     *
     * @param paths        要查询的目录 List
     * @param userId       用户 id
     * @param pathPermCode 权限码
     * @return 没有权限的目录
     */
    List<NetworkPath> checkPathsHasPerm(List<NetworkPath> paths, String userId, String... pathPermCode);

    /**
     * 检查当前目录及其子目录是否有指定权限
     *
     * @param path         当前目录 id
     * @param pathPermCode 权限码
     * @return 没有权限的目录
     */
    List<NetworkPath> checkThisAndChildrenHasPerm(NetworkPath path, String userId, String... pathPermCode);

}
